<?php

/*
 * Edit by shengxin
 * Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
 */
namespace app\admin\controller;

use cmf\controller\AdminBaseController;
use api\mall\model\StoreModel;
/**
 * Description of LoggerController
 *
 * @author PC
 */
class StoreController extends AdminBaseController{
    
    public function index(){
        $storeModel = new StoreModel();
        $page = $storeModel->paginate();
        $this->assign('items',$page->items());
        $this->assign('page',$page->render());
        return $this->fetch();
    }
    
    public function add(){
        $storeModel = new StoreModel();
        $items = $storeModel->types();
        $this->assign('item_types',$items);
        return $this->fetch();
    }
    
    public function edit(){
        $id = $this->request->get('id');
        $storeModel = new StoreModel();
        $data = $storeModel->where('id',$id)->find();
        if($data){
            $this->assign($data->toArray());

        }
        return $this->fetch();
    }
}
